<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class CreateDictionaryItemTable extends Migration
{
    /**
     * Run the migrations.
     */
    public function up(): void
    {
        Schema::create('dictionary_item', function (Blueprint $table) {
//            $table->comment('字典详情');
            $table->bigInteger('id', true);
            $table->string('code', 255)->nullable()->index('code_idx')->comment('字典code');
            $table->string('item_name', 255)->nullable()->comment('字典项名称');
            $table->string('item_value', 255)->nullable()->index('item_value_idx')->comment('字典项值');
            $table->bigInteger('parent_id')->nullable()->default(0)->index('pid_idx')->comment('父节点id');
            $table->integer('item_order')->nullable()->default(0)->comment('顺序');
            $table->integer('deleted')->nullable()->default(0)->comment('是否删除');
            $table->timestamp('created_at')->nullable()->useCurrent();
            $table->bigInteger('creator_id')->nullable()->default(0);
            $table->timestamp('updated_at')->useCurrentOnUpdate()->nullable()->useCurrent();
            $table->integer('updater_id')->nullable()->default(0);
        });
    }

    /**
     * Reverse the migrations.
     */
    public function down(): void
    {
        Schema::dropIfExists('dictionary_item');
    }
};
